Check if all objects of type A and B can be placed on N shelves
Given two integers A and B, representing the count of objects of two different types, and another integer N which represents the number of shelves, the task is to place all objects in the given N shelves abiding by the following rules:...
read more
All reverse permutations of an array using STL in C++
Given an array, the task is to print or display all the reverse permutations of this array using STL in C++. Reverse permutation means, for an array {1, 2, 3}:...
read more
Minimum length of Run Length Encoding possible by removing at most K characters from a given string
Given a string S of length N, consisting of lowercase English alphabets only, the task is to find the minimum possible length of run-length-encoding that can be generated by removing at most K characters from the string S....
read more
Collision Course | TCS MockVita 2020
On a busy road, multiple cars are passing by. A simulation is run to see what happens if brakes fail for all cars on the road. The only way for them to be safe is if they don’t collide and pass by each other. The goal is to identify whether any of the given cars would collide or pass by each other safely around a Roundabout. Think of this as a reference point O ( Origin with coordinates (0, 0) ), but instead of going around it, cars pass through it....
read more
Count number of triangles possible with length of sides not exceeding N
Given an integer N, the task is to find the total number of right angled triangles that can be formed such that the length of any side of the triangle is at most N....
read more
Number of ways to reach (M, N) in a matrix starting from the origin without visiting (X, Y)
Given four positive integers M, N, X, and Y, the task is to count all the possible ways to reach from the top left(i.e., (0, 0)) to the bottom right (M, N) of a matrix of size (M+1)x(N+1) without visiting the cell (X, Y). It is given that from each cell (i, j) you can either move only to right (i, j + 1) or down (i + 1, j)....
read more
Minimum cost to convert 1 to N by multiplying X or right rotation of digits
Given two integers N and X, the task is to convert 1 to N using minimum operations of any of the following operations:...
read more
Sudo Placement[1.3] | Final Destination
Given an array of integers and a number K with initial and final values. Your task is to find the minimum number of steps required to get final value starting from the initial value using the array elements. You can only do add (add operation % 1000) on values to get the final value. At every step, you are allowed to add any of the array elements with modulus operation....
read more
Permutation
Permutation in mathematics is the arrangement of the object in a definite order. Permutation is similar to the combination and the basic difference between permutation and combination is that in permutation the order in which the object is taken is important while the combination is the arrangement of the objects when the order of the objects is not important....
read more
Print all combinations generated by characters of a numeric string which does not exceed N
Given a numeric string S of length M and an integer N, the task is to find all distinct combinations of S (repetitions allowed) that are at most N....
read more
Circular Permutation
Circular Permutation is an arrangement notion in which the objects are arranged in a closed loop. The beginning and end points are ambiguous, in contrast to linear layouts. Since one item can be fixed and the others positioned around it, there are (n-1)! circular permutations of the ‘n’ objects. 5 persons seated around a circle-shaped table, for instance, produces 4! or 24 variants. It is important to distinguish between circular and linear permutations since the counting method is impacted by the arrangement’s cyclical nature. This idea offers a unique viewpoint on how to organize parts in a circular layout and has applications in a variety of industries, including seating arrangements, clock setups, and molecular structures....
read more
Generate a Matrix with mean of each subarray of each row as an integer
Given two integers M and N, the task is to generate an MxN matrix having elements in range [1, MxN] such that the average of any subarray of any row is an integer. If it is not possible to do so, return -1....
read more